<template>
	<view>
		<view class="user-bg  px-3">
			<view class="flex j-start a-center" @click="navigateTo('/pages/user/profile')">
				<u-avatar :src="userInfo.avatarUrl" :size="70"></u-avatar>
				<view class="ml-2">
					<view class="font-36 mb-1 text-white">{{userInfo.nickName}}</view>
					<view class="text-white">{{userInfo.phone}}</view>
				</view>
			</view>
		</view>
		<view class="p-3" style="margin-top: -150rpx;">
			<view class="bg-white shadow-lg px-3 py-1 rounded-20">
				<!-- roleFlag   0客户 1内部人员(扫码权限) -->
				<view class="flex j-sb a-center py-4 border-bottom" @click="scanHandle" v-if="userInfo.roleFlag==1">
					<view class="flex j-start a-center">
						<image src="/static/images/sm.png" mode="widthFix" class="svg40"></image>
						<view class="ml-2 font-32">扫 码 </view>
					</view>
					<u-icon name="arrow-right" color="#888" size="15"></u-icon>
				</view>
				<view class="flex j-sb a-center py-4 border-bottom">
					<view class="flex j-start a-center">
						<image src="/static/images/icon1.png" mode="widthFix" class="svg40"></image>
						<view class="ml-2 font-32">我的关注</view>
					</view>
					<u-icon name="arrow-right" color="#888" size="15"></u-icon>
				</view>
				<view class="flex j-sb a-center py-4 border-bottom"
					@click="navigateTo('/pages/user/declarations?type=0')">
					<view class="flex j-start a-center">
						<image src="/static/images/icon2.png" mode="widthFix" class="svg40"></image>
						<view class="ml-2 font-32">隐私协议</view>
					</view>
					<u-icon name="arrow-right" color="#888" size="15"></u-icon>
				</view>
				<view class="flex j-sb a-center py-4 border-bottom"
					@click="navigateTo('/pages/user/declarations?type=1')">
					<view class="flex j-start a-center">
						<image src="/static/images/icon3.png" mode="widthFix" class="svg40"></image>
						<view class="ml-2 font-32">免责声明</view>
					</view>
					<u-icon name="arrow-right" color="#888" size="15"></u-icon>
				</view>
				<view class="flex j-sb a-center py-4" @click="navigateTo('/pages/user/declarations?type=2')">
					<view class="flex j-start a-center">
						<image src="/static/images/icon4.png" mode="widthFix" class="svg40"></image>
						<view class="ml-2 font-32">关于我们</view>
					</view>
					<u-icon name="arrow-right" color="#888" size="15"></u-icon>
				</view>
			</view>
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {

			}
		},
		onShow() {
			if (uni.getStorageSync('token')) {
				this.getUserInfos()
			} else {
				uni.reLaunch({
					url: '/pages/login/index'
				})
			}
		},
		methods: {
			scanHandle() {
				uni.scanCode({
					scanType: ['qrCode'],
					success: function(res) {
						console.log('条码类型：' + res.scanType);
						console.log('条码内容：' + res.result);
					}
				});
			}
		}
	}
</script>

<style lang="scss">
	page {
		background-color: #fff;
	}

	.user-bg {
		height: 400rpx;
		padding-top: 70rpx;
		background-image: linear-gradient(to bottom, #167bff, #fff);
	}
</style>